home *** CD-ROM | disk | FTP | other *** search
- package com.ibm.ivb.sguides.cb;
-
- import com.ibm.ivb.sguides.SmartGuideNotebook;
- import com.ibm.ivb.sguides.SmartGuidePage;
- import java.awt.Component;
- import java.awt.Insets;
- import java.awt.Point;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.AbstractButton;
- import javax.swing.ButtonModel;
- import javax.swing.JButton;
- import javax.swing.JCheckBoxMenuItem;
- import javax.swing.JComponent;
- import javax.swing.JMenuItem;
- import javax.swing.JPopupMenu;
- import javax.swing.event.ChangeEvent;
- import javax.swing.event.ChangeListener;
- import javax.swing.event.PopupMenuEvent;
- import javax.swing.event.PopupMenuListener;
-
- class CBSmartGuideNotebookUI$NavButton extends JButton implements ChangeListener, ActionListener, PopupMenuListener {
- // $FF: synthetic field
- private final CBSmartGuideNotebookUI this$0;
- JPopupMenu popup;
- // $FF: renamed from: ch com.ibm.ivb.sguides.cb.CBSmartGuideNotebookUI.CommandHandler
- CBSmartGuideNotebookUI.CommandHandler field_0;
- SmartGuideNotebook sgbook;
- boolean myCancel;
- // $FF: renamed from: pl java.awt.Point
- Point field_1;
- boolean pressed;
-
- public CBSmartGuideNotebookUI$NavButton(CBSmartGuideNotebookUI var1, SmartGuideNotebook var2) {
- super(CBSmartGuideNotebookUI.navIcon);
- this.this$0 = var1;
- this.this$0 = var1;
- this.myCancel = false;
- this.pressed = false;
- ((AbstractButton)this).addChangeListener(this);
- ((AbstractButton)this).addActionListener(this);
- this.sgbook = var2;
- ((JComponent)this).setOpaque(false);
- }
-
- public void setPopupLocation(Point var1) {
- this.field_1 = var1;
- }
-
- public void updateUI() {
- super.updateUI();
- ((AbstractButton)this).setMargin(new Insets(2, 2, 2, 2));
- ((AbstractButton)this).setBorderPainted(false);
- ((AbstractButton)this).setRolloverEnabled(true);
- ((JComponent)this).setRequestFocusEnabled(false);
- ((JComponent)this).setBorder(CBSmartGuideNotebookUI.navBorder);
- }
-
- public boolean isFocusTraversable() {
- return false;
- }
-
- public void actionPerformed(ActionEvent var1) {
- if (this.popup != null && this.myCancel) {
- this.popup.setVisible(false);
- this.myCancel = false;
- } else {
- this.makePopup();
- if (this.popup != null) {
- Point var2 = this.sgbook.getLocationOnScreen();
- int var3 = var2.x + this.field_1.x;
- int var4 = var2.y + this.field_1.y;
- this.popup.setLocation(var3, var4);
- this.popup.setVisible(true);
- this.myCancel = false;
- }
-
- }
- }
-
- public void stateChanged(ChangeEvent var1) {
- ButtonModel var2 = ((AbstractButton)this).getModel();
- this.pressed = var2.isArmed() && var2.isPressed();
- ((AbstractButton)this).setBorderPainted(var2.isRollover());
- ((Component)this).repaint();
- }
-
- public void popupMenuCanceled(PopupMenuEvent var1) {
- this.myCancel = this.pressed;
- }
-
- public void popupMenuWillBecomeInvisible(PopupMenuEvent var1) {
- }
-
- public void popupMenuWillBecomeVisible(PopupMenuEvent var1) {
- }
-
- void makePopup() {
- if (this.popup == null) {
- this.popup = new JPopupMenu();
- this.popup.setInvoker(this.sgbook.getParent());
- this.field_0 = new CBSmartGuideNotebookUI.CommandHandler(this.this$0, this.sgbook);
- this.popup.addPopupMenuListener(this);
- } else {
- this.popup.removeAll();
- }
-
- boolean var1 = true;
- SmartGuidePage var2 = this.sgbook.getCurrentPage();
-
- for(SmartGuidePage var3 = this.sgbook.getPageAt(0); var3 != null; var3 = var3.getNextPage()) {
- Object var4 = var3 == var2 ? new JCheckBoxMenuItem(var3.getTitle()) : new JMenuItem(var3.getTitle());
- ((AbstractButton)var4).setActionCommand(var3.toString());
- ((JComponent)var4).putClientProperty("SmartGuidePage", var3);
- if (var3 == var2) {
- var1 = false;
- ((JMenuItem)var4).setEnabled(false);
- ((JCheckBoxMenuItem)var4).setSelected(true);
- } else if (!var1) {
- ((JMenuItem)var4).setEnabled(var2.isPageComplete());
- }
-
- ((AbstractButton)var4).addActionListener(this.field_0);
- this.popup.add((JMenuItem)var4);
- }
-
- }
- }
-